﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>DataTablesTest</title>

    <link rel="stylesheet" type="text/css" href="http://cdn.datatables.net/1.10.12/css/jquery.dataTables.css">

    <!-- jQuery -->
    <script type="text/javascript" charset="utf8" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>

    <!-- DataTables -->
    <script type="text/javascript" charset="utf8" src="http://cdn.datatables.net/1.10.12/js/jquery.dataTables.js"></script>


</head>
<body>
    <!--第二步：添加如下 HTML 代码-->
    <table id="table_id_example" class="display">
        <thead>
            <tr>
                <th>姓名</th>
                <th>性别</th>
            </tr>
        </thead>

    </table>
</body>
</html>

<script>

    $(document).ready(function () {

      

        $(document).ready(function () {
            $('#table_id_example').DataTable({
                "ajax": { url: "GetData", /*要寻找的数据集合属性名*/ "dataSrc": "Jsondata",type:"POST"},
                "columns": [
                    { "data": "name" },
                    { "data": "sex" },

                ],
                "serverSide": true,
                processing: true,
                search: "searchPlaceholder"
            });
        });
    });
</script>
